package main
import (
	"fmt"
	"os"
)

func main(){
	ReadFile("./读取文件.go")
}

func ReadFile(filename string){
	f, err := os.Open(filename)
	if err != nil{
		fmt.Println("读取失败，err = ", err)
		return
	}
	defer f.Close()
	
	buf := make([]byte, 460)
	num, err2 := f.Read(buf)
	if err2!=nil{
		fmt.Println("err2 = ", err2)
		return
	}
	fmt.Println("读取了", num, "个字节，内容为：")
	fmt.Println(string(buf))
}